home *** CD-ROM | disk | FTP | other *** search
/ Freelog 115 / FreelogNo115-MaiJuin2013.iso / Internet / Free Download Manager / fdminst.exe / {app} / player.swf / scripts / __Packages / mx / video / CuePointManager.as next >
Encoding:
Text File  |  2012-08-12  |  27.7 KB  |  848 lines

  1. class mx.video.CuePointManager
  2. {
  3.    var _owner;
  4.    var _id;
  5.    var _asCuePointTolerance;
  6.    var _linearSearchTolerance;
  7.    var _metadataLoaded;
  8.    var allCuePoints;
  9.    var asCuePoints;
  10.    var _disabledCuePoints;
  11.    var flvCuePoints;
  12.    var navCuePoints;
  13.    var eventCuePoints;
  14.    var _asCuePointIndex;
  15.    var _disabledCuePointsByNameOnly;
  16.    static var DEFAULT_LINEAR_SEARCH_TOLERANCE = 50;
  17.    static var cuePointsReplace = [""","\"","'","\'",",",",","&","&"];
  18.    function CuePointManager(owner, id)
  19.    {
  20.       this._owner = owner;
  21.       this._id = id;
  22.       this.reset();
  23.       this._asCuePointTolerance = this._owner.getVideoPlayer(this._id).playheadUpdateInterval / 2000;
  24.       this._linearSearchTolerance = mx.video.CuePointManager.DEFAULT_LINEAR_SEARCH_TOLERANCE;
  25.    }
  26.    function reset()
  27.    {
  28.       this._metadataLoaded = false;
  29.       this.allCuePoints = null;
  30.       this.asCuePoints = null;
  31.       this._disabledCuePoints = null;
  32.       this.flvCuePoints = null;
  33.       this.navCuePoints = null;
  34.       this.eventCuePoints = null;
  35.       this._asCuePointIndex = 0;
  36.    }
  37.    function get metadataLoaded()
  38.    {
  39.       return this._metadataLoaded;
  40.    }
  41.    function set playheadUpdateInterval(aTime)
  42.    {
  43.       this._asCuePointTolerance = aTime / 2000;
  44.    }
  45.    function get id()
  46.    {
  47.       return this._id;
  48.    }
  49.    function addASCuePoint(timeOrCuePoint, name, parameters)
  50.    {
  51.       var _loc3_ = undefined;
  52.       if(typeof timeOrCuePoint == "object")
  53.       {
  54.          _loc3_ = mx.video.CuePointManager.deepCopyObject(timeOrCuePoint);
  55.       }
  56.       else
  57.       {
  58.          _loc3_ = {time:timeOrCuePoint,name:name,parameters:mx.video.CuePointManager.deepCopyObject(parameters)};
  59.       }
  60.       var _loc7_ = isNaN(_loc3_.time) || _loc3_.time < 0;
  61.       if(_loc7_)
  62.       {
  63.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"time must be number");
  64.       }
  65.       var _loc6_ = _loc3_.name == undefined || _loc3_.name == null;
  66.       if(_loc6_)
  67.       {
  68.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"name cannot be undefined or null");
  69.       }
  70.       var _loc2_ = undefined;
  71.       _loc3_.type = "actionscript";
  72.       if(this.asCuePoints == null || this.asCuePoints == undefined || this.asCuePoints.length < 1)
  73.       {
  74.          _loc2_ = 0;
  75.          this.asCuePoints = new Array();
  76.          this.asCuePoints.push(_loc3_);
  77.       }
  78.       else
  79.       {
  80.          _loc2_ = this.getCuePointIndex(this.asCuePoints,true,_loc3_.time);
  81.          _loc2_ = this.asCuePoints[_loc2_].time <= _loc3_.time ? _loc2_ + 1 : 0;
  82.          this.asCuePoints.splice(_loc2_,0,_loc3_);
  83.       }
  84.       if(this.allCuePoints == null || this.allCuePoints == undefined || this.allCuePoints.length < 1)
  85.       {
  86.          _loc2_ = 0;
  87.          this.allCuePoints = new Array();
  88.          this.allCuePoints.push(_loc3_);
  89.       }
  90.       else
  91.       {
  92.          _loc2_ = this.getCuePointIndex(this.allCuePoints,true,_loc3_.time);
  93.          _loc2_ = this.allCuePoints[_loc2_].time <= _loc3_.time ? _loc2_ + 1 : 0;
  94.          this.allCuePoints.splice(_loc2_,0,_loc3_);
  95.       }
  96.       var _loc5_ = this._owner.getVideoPlayer(this._id).playheadTime;
  97.       if(_loc5_ > 0)
  98.       {
  99.          if(this._asCuePointIndex == _loc2_)
  100.          {
  101.             if(_loc5_ > this.asCuePoints[_loc2_].time)
  102.             {
  103.                this._asCuePointIndex = this._asCuePointIndex + 1;
  104.             }
  105.          }
  106.          else if(this._asCuePointIndex > _loc2_)
  107.          {
  108.             this._asCuePointIndex = this._asCuePointIndex + 1;
  109.          }
  110.       }
  111.       else
  112.       {
  113.          this._asCuePointIndex = 0;
  114.       }
  115.       var _loc4_ = mx.video.CuePointManager.deepCopyObject(this.asCuePoints[_loc2_]);
  116.       _loc4_.array = this.asCuePoints;
  117.       _loc4_.index = _loc2_;
  118.       return _loc4_;
  119.    }
  120.    function removeASCuePoint(timeNameOrCuePoint)
  121.    {
  122.       if(this.asCuePoints == null || this.asCuePoints == undefined || this.asCuePoints.length < 1)
  123.       {
  124.          return null;
  125.       }
  126.       var _loc3_ = undefined;
  127.       switch(typeof timeNameOrCuePoint)
  128.       {
  129.          case "string":
  130.             _loc3_ = {name:timeNameOrCuePoint};
  131.             break;
  132.          case "number":
  133.             _loc3_ = {time:timeNameOrCuePoint};
  134.             break;
  135.          case "object":
  136.             _loc3_ = timeNameOrCuePoint;
  137.       }
  138.       var _loc2_ = this.getCuePointIndex(this.asCuePoints,false,_loc3_.time,_loc3_.name);
  139.       if(_loc2_ < 0)
  140.       {
  141.          return null;
  142.       }
  143.       _loc3_ = this.asCuePoints[_loc2_];
  144.       this.asCuePoints.splice(_loc2_,1);
  145.       _loc2_ = this.getCuePointIndex(this.allCuePoints,false,_loc3_.time,_loc3_.name);
  146.       if(_loc2_ > 0)
  147.       {
  148.          this.allCuePoints.splice(_loc2_,1);
  149.       }
  150.       if(this._owner.getVideoPlayer(this._id).playheadTime > 0)
  151.       {
  152.          if(this._asCuePointIndex > _loc2_)
  153.          {
  154.             this._asCuePointIndex = this._asCuePointIndex - 1;
  155.          }
  156.       }
  157.       else
  158.       {
  159.          this._asCuePointIndex = 0;
  160.       }
  161.       return _loc3_;
  162.    }
  163.    function setFLVCuePointEnabled(enabled, timeNameOrCuePoint)
  164.    {
  165.       var _loc4_ = undefined;
  166.       switch(typeof timeNameOrCuePoint)
  167.       {
  168.          case "string":
  169.             _loc4_ = {name:timeNameOrCuePoint};
  170.             break;
  171.          case "number":
  172.             _loc4_ = {time:timeNameOrCuePoint};
  173.             break;
  174.          case "object":
  175.             _loc4_ = timeNameOrCuePoint;
  176.       }
  177.       var _loc12_ = isNaN(_loc4_.time) || _loc4_.time < 0;
  178.       var _loc11_ = _loc4_.name == undefined || _loc4_.name == null;
  179.       if(_loc12_ && _loc11_)
  180.       {
  181.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"time must be number and/or name must not be undefined or null");
  182.       }
  183.       var _loc6_ = 0;
  184.       var _loc2_ = undefined;
  185.       var _loc5_ = undefined;
  186.       if(_loc12_)
  187.       {
  188.          if(!this._metadataLoaded)
  189.          {
  190.             if(this._disabledCuePointsByNameOnly[_loc4_.name] == undefined)
  191.             {
  192.                if(!enabled)
  193.                {
  194.                   if(this._disabledCuePointsByNameOnly == null || this._disabledCuePointsByNameOnly == undefined || this._disabledCuePointsByNameOnly.length < 0)
  195.                   {
  196.                      this._disabledCuePointsByNameOnly = new Object();
  197.                   }
  198.                   this._disabledCuePointsByNameOnly[_loc4_.name] = new Array();
  199.                }
  200.                this.removeCuePoints(this._disabledCuePoints,_loc4_);
  201.                return -1;
  202.             }
  203.             if(enabled)
  204.             {
  205.                this._disabledCuePointsByNameOnly[_loc4_.name] = undefined;
  206.             }
  207.             return -1;
  208.          }
  209.          if(enabled)
  210.          {
  211.             _loc6_ = this.removeCuePoints(this._disabledCuePoints,_loc4_);
  212.          }
  213.          else
  214.          {
  215.             var _loc3_ = undefined;
  216.             _loc2_ = this.getCuePointIndex(this.flvCuePoints,true,-1,_loc4_.name);
  217.             while(_loc2_ >= 0)
  218.             {
  219.                _loc3_ = this.flvCuePoints[_loc2_];
  220.                _loc5_ = this.getCuePointIndex(this._disabledCuePoints,true,_loc3_.time);
  221.                if(_loc5_ < 0 || this._disabledCuePoints[_loc5_].time != _loc3_.time)
  222.                {
  223.                   this._disabledCuePoints = this.insertCuePoint(_loc5_,this._disabledCuePoints,{name:_loc3_.name,time:_loc3_.time});
  224.                   _loc6_ += 1;
  225.                }
  226.                _loc2_ = this.getNextCuePointIndexWithName(_loc3_.name,this.flvCuePoints,_loc2_);
  227.             }
  228.          }
  229.          return _loc6_;
  230.       }
  231.       _loc2_ = this.getCuePointIndex(this._disabledCuePoints,false,_loc4_.time,_loc4_.name);
  232.       if(_loc2_ < 0)
  233.       {
  234.          if(enabled)
  235.          {
  236.             if(!this._metadataLoaded)
  237.             {
  238.                _loc2_ = this.getCuePointIndex(this._disabledCuePoints,false,_loc4_.time);
  239.                if(_loc2_ < 0)
  240.                {
  241.                   _loc5_ = this.getCuePointIndex(this._disabledCuePointsByNameOnly[_loc4_.name],true,_loc4_.time);
  242.                   if(mx.video.CuePointManager.cuePointCompare(_loc4_.time,null,this._disabledCuePointsByNameOnly[_loc4_.name]) != 0)
  243.                   {
  244.                      this._disabledCuePointsByNameOnly[_loc4_.name] = this.insertCuePoint(_loc5_,this._disabledCuePointsByNameOnly[_loc4_.name],_loc4_);
  245.                   }
  246.                }
  247.                else
  248.                {
  249.                   this._disabledCuePoints.splice(_loc2_,1);
  250.                }
  251.             }
  252.             return !this._metadataLoaded ? -1 : 0;
  253.          }
  254.          if(this._metadataLoaded)
  255.          {
  256.             _loc2_ = this.getCuePointIndex(this.flvCuePoints,false,_loc4_.time,_loc4_.name);
  257.             if(_loc2_ < 0)
  258.             {
  259.                return 0;
  260.             }
  261.             if(_loc11_)
  262.             {
  263.                _loc4_.name = this.flvCuePoints[_loc2_].name;
  264.             }
  265.          }
  266.          _loc5_ = this.getCuePointIndex(this._disabledCuePoints,true,_loc4_.time);
  267.          this._disabledCuePoints = this.insertCuePoint(_loc5_,this._disabledCuePoints,_loc4_);
  268.          _loc6_ = 1;
  269.          return !this._metadataLoaded ? -1 : 1;
  270.       }
  271.       if(enabled)
  272.       {
  273.          this._disabledCuePoints.splice(_loc2_,1);
  274.          _loc6_ = 1;
  275.       }
  276.       else
  277.       {
  278.          _loc6_ = 0;
  279.       }
  280.       return !this._metadataLoaded ? -1 : _loc6_;
  281.    }
  282.    function removeCuePoints(cuePointArray, cuePoint)
  283.    {
  284.       var _loc2_ = undefined;
  285.       var _loc4_ = undefined;
  286.       var _loc5_ = 0;
  287.       _loc2_ = this.getCuePointIndex(cuePointArray,true,-1,cuePoint.name);
  288.       while(_loc2_ >= 0)
  289.       {
  290.          _loc4_ = cuePointArray[_loc2_];
  291.          cuePointArray.splice(_loc2_,1);
  292.          _loc2_ = _loc2_ - 1;
  293.          _loc5_ = _loc5_ + 1;
  294.          _loc2_ = this.getNextCuePointIndexWithName(_loc4_.name,cuePointArray,_loc2_);
  295.       }
  296.       return _loc5_;
  297.    }
  298.    function insertCuePoint(insertIndex, cuePointArray, cuePoint)
  299.    {
  300.       if(insertIndex < 0)
  301.       {
  302.          cuePointArray = new Array();
  303.          cuePointArray.push(cuePoint);
  304.       }
  305.       else
  306.       {
  307.          if(cuePointArray[insertIndex].time > cuePoint.time)
  308.          {
  309.             insertIndex = 0;
  310.          }
  311.          else
  312.          {
  313.             insertIndex = insertIndex + 1;
  314.          }
  315.          cuePointArray.splice(insertIndex,0,cuePoint);
  316.       }
  317.       return cuePointArray;
  318.    }
  319.    function isFLVCuePointEnabled(timeNameOrCuePoint)
  320.    {
  321.       if(!this._metadataLoaded)
  322.       {
  323.          return true;
  324.       }
  325.       var _loc3_ = undefined;
  326.       switch(typeof timeNameOrCuePoint)
  327.       {
  328.          case "string":
  329.             _loc3_ = {name:timeNameOrCuePoint};
  330.             break;
  331.          case "number":
  332.             _loc3_ = {time:timeNameOrCuePoint};
  333.             break;
  334.          case "object":
  335.             _loc3_ = timeNameOrCuePoint;
  336.       }
  337.       var _loc5_ = isNaN(_loc3_.time) || _loc3_.time < 0;
  338.       var _loc6_ = _loc3_.name == undefined || _loc3_.name == null;
  339.       if(_loc5_ && _loc6_)
  340.       {
  341.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"time must be number and/or name must not be undefined or null");
  342.       }
  343.       if(_loc5_)
  344.       {
  345.          var _loc2_ = this.getCuePointIndex(this.flvCuePoints,true,-1,_loc3_.name);
  346.          if(_loc2_ < 0)
  347.          {
  348.             return true;
  349.          }
  350.          while(_loc2_ >= 0)
  351.          {
  352.             if(this.getCuePointIndex(this._disabledCuePoints,false,this.flvCuePoints[_loc2_].time,this.flvCuePoints[_loc2_].name) < 0)
  353.             {
  354.                return true;
  355.             }
  356.             _loc2_ = this.getNextCuePointIndexWithName(_loc3_.name,this.flvCuePoints,_loc2_);
  357.          }
  358.          return false;
  359.       }
  360.       return this.getCuePointIndex(this._disabledCuePoints,false,_loc3_.time,_loc3_.name) < 0;
  361.    }
  362.    function dispatchASCuePoints()
  363.    {
  364.       var _loc5_ = this._owner.getVideoPlayer(this._id).playheadTime;
  365.       if(this._owner.getVideoPlayer(this._id).stateResponsive && this.asCuePoints != null && this.asCuePoints != undefined)
  366.       {
  367.          while(this._asCuePointIndex < this.asCuePoints.length && this.asCuePoints[this._asCuePointIndex].time <= _loc5_ + this._asCuePointTolerance)
  368.          {
  369.             this._owner.dispatchEvent({type:"cuePoint",info:mx.video.CuePointManager.deepCopyObject(this.asCuePoints[this._asCuePointIndex++]),vp:this._id});
  370.          }
  371.       }
  372.    }
  373.    function resetASCuePointIndex(time)
  374.    {
  375.       if(time <= 0 || this.asCuePoints == null || this.asCuePoints == undefined)
  376.       {
  377.          this._asCuePointIndex = 0;
  378.          return undefined;
  379.       }
  380.       var _loc2_ = this.getCuePointIndex(this.asCuePoints,true,time);
  381.       this._asCuePointIndex = this.asCuePoints[_loc2_].time >= time ? _loc2_ : _loc2_ + 1;
  382.    }
  383.    function processFLVCuePoints(metadataCuePoints)
  384.    {
  385.       this._metadataLoaded = true;
  386.       if(metadataCuePoints == undefined || metadataCuePoints == null || metadataCuePoints.length < 1)
  387.       {
  388.          this.flvCuePoints = null;
  389.          this.navCuePoints = null;
  390.          this.eventCuePoints = null;
  391.          return undefined;
  392.       }
  393.       this.flvCuePoints = metadataCuePoints;
  394.       this.navCuePoints = new Array();
  395.       this.eventCuePoints = new Array();
  396.       var _loc5_ = undefined;
  397.       var _loc6_ = -1;
  398.       var _loc2_ = undefined;
  399.       var _loc4_ = this._disabledCuePoints;
  400.       var _loc3_ = 0;
  401.       this._disabledCuePoints = new Array();
  402.       var _loc9_ = 0;
  403.       while(true)
  404.       {
  405.          _loc9_;
  406.          if((_loc2_ = this.flvCuePoints[_loc9_++]) == undefined)
  407.          {
  408.             break;
  409.          }
  410.          if(_loc6_ > 0 && _loc6_ >= _loc2_.time)
  411.          {
  412.             this.flvCuePoints = null;
  413.             this.navCuePoints = null;
  414.             this.eventCuePoints = null;
  415.             this._disabledCuePoints = null;
  416.             this._disabledCuePointsByNameOnly = null;
  417.             throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"Unsorted cuePoint found after time: " + _loc6_);
  418.          }
  419.          _loc6_ = _loc2_.time;
  420.          while(_loc3_ < _loc4_.length && mx.video.CuePointManager.cuePointCompare(_loc4_[_loc3_].time,null,_loc2_) < 0)
  421.          {
  422.             _loc3_ = _loc3_ + 1;
  423.          }
  424.          if(this._disabledCuePointsByNameOnly[_loc2_.name] != undefined || _loc3_ < _loc4_.length && mx.video.CuePointManager.cuePointCompare(_loc4_[_loc3_].time,_loc4_[_loc3_].name,_loc2_) == 0)
  425.          {
  426.             this._disabledCuePoints.push({time:_loc2_.time,name:_loc2_.name});
  427.          }
  428.          if(_loc2_.type == "navigation")
  429.          {
  430.             this.navCuePoints.push(_loc2_);
  431.          }
  432.          else if(_loc2_.type == "event")
  433.          {
  434.             this.eventCuePoints.push(_loc2_);
  435.          }
  436.          if(this.allCuePoints == null || this.allCuePoints == undefined || this.allCuePoints.length < 1)
  437.          {
  438.             this.allCuePoints = new Array();
  439.             this.allCuePoints.push(_loc2_);
  440.          }
  441.          else
  442.          {
  443.             _loc5_ = this.getCuePointIndex(this.allCuePoints,true,_loc2_.time);
  444.             _loc5_ = this.allCuePoints[_loc5_].time <= _loc2_.time ? _loc5_ + 1 : 0;
  445.             this.allCuePoints.splice(_loc5_,0,_loc2_);
  446.          }
  447.       }
  448.       delete this._disabledCuePointsByNameOnly;
  449.       this._disabledCuePointsByNameOnly = null;
  450.       delete this._disabledCuePointsByNameOnly;
  451.       this._disabledCuePointsByNameOnly = null;
  452.    }
  453.    function processCuePointsProperty(cuePoints)
  454.    {
  455.       if(cuePoints == undefined || cuePoints == null || cuePoints.length == 0)
  456.       {
  457.          return undefined;
  458.       }
  459.       var _loc4_ = 0;
  460.       var _loc8_ = undefined;
  461.       var _loc6_ = undefined;
  462.       var _loc7_ = undefined;
  463.       var _loc5_ = undefined;
  464.       var _loc9_ = undefined;
  465.       var _loc2_ = 0;
  466.       while(_loc2_ < cuePoints.length - 1)
  467.       {
  468.          switch(_loc4_)
  469.          {
  470.             case 6:
  471.                this.addOrDisable(_loc9_,_loc5_);
  472.                _loc4_ = 0;
  473.             case 0:
  474.                _loc2_;
  475.                if(cuePoints[_loc2_++] != "t")
  476.                {
  477.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"unexpected cuePoint parameter format");
  478.                }
  479.                if(isNaN(cuePoints[_loc2_]))
  480.                {
  481.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"time must be number");
  482.                }
  483.                break;
  484.             case 1:
  485.                _loc2_;
  486.                if(cuePoints[_loc2_++] != "n")
  487.                {
  488.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"unexpected cuePoint parameter format");
  489.                }
  490.                if(cuePoints[_loc2_] == undefined || cuePoints[_loc2_] == null)
  491.                {
  492.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"name cannot be null or undefined");
  493.                }
  494.                _loc5_.name = this.unescape(cuePoints[_loc2_]);
  495.                _loc4_ = _loc4_ + 1;
  496.                break;
  497.             case 2:
  498.                _loc2_;
  499.                if(cuePoints[_loc2_++] != "t")
  500.                {
  501.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"unexpected cuePoint parameter format");
  502.                }
  503.                if(isNaN(cuePoints[_loc2_]))
  504.                {
  505.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"type must be number");
  506.                }
  507.                switch(cuePoints[_loc2_])
  508.                {
  509.                   case 0:
  510.                      _loc5_.type = "event";
  511.                      break;
  512.                   case 1:
  513.                      _loc5_.type = "navigation";
  514.                      break;
  515.                   case 2:
  516.                      _loc5_.type = "actionscript";
  517.                      break;
  518.                   default:
  519.                      throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"type must be 0, 1 or 2");
  520.                }
  521.                _loc4_ = _loc4_ + 1;
  522.                break;
  523.             case 3:
  524.                _loc2_;
  525.                if(cuePoints[_loc2_++] != "d")
  526.                {
  527.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"unexpected cuePoint parameter format");
  528.                }
  529.                if(isNaN(cuePoints[_loc2_]))
  530.                {
  531.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"disabled must be number");
  532.                }
  533.                _loc9_ = cuePoints[_loc2_] != 0;
  534.                _loc4_ = _loc4_ + 1;
  535.                break;
  536.             case 4:
  537.                _loc2_;
  538.                if(cuePoints[_loc2_++] != "p")
  539.                {
  540.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"unexpected cuePoint parameter format");
  541.                }
  542.                if(isNaN(cuePoints[_loc2_]))
  543.                {
  544.                   throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"num params must be number");
  545.                }
  546.                _loc8_ = cuePoints[_loc2_];
  547.                _loc4_ = _loc4_ + 1;
  548.                if(_loc8_ == 0)
  549.                {
  550.                   _loc4_ = _loc4_ + 1;
  551.                }
  552.                else
  553.                {
  554.                   _loc5_.parameters = new Object();
  555.                }
  556.                break;
  557.             case 5:
  558.                _loc2_;
  559.                _loc6_ = cuePoints[_loc2_++];
  560.                _loc7_ = cuePoints[_loc2_];
  561.                if(typeof _loc6_ == "string")
  562.                {
  563.                   _loc6_ = this.unescape(_loc6_);
  564.                }
  565.                if(typeof _loc7_ == "string")
  566.                {
  567.                   _loc7_ = this.unescape(_loc7_);
  568.                }
  569.                _loc5_.parameters[_loc6_] = _loc7_;
  570.                _loc8_ = _loc8_ - 1;
  571.                if(_loc8_ == 0)
  572.                {
  573.                   _loc4_ = _loc4_ + 1;
  574.                }
  575.                break;
  576.          }
  577.          _loc5_ = new Object();
  578.          _loc5_.time = cuePoints[_loc2_] / 1000;
  579.          _loc4_ = _loc4_ + 1;
  580.          _loc2_ = _loc2_ + 1;
  581.       }
  582.       if(_loc4_ == 6)
  583.       {
  584.          this.addOrDisable(_loc9_,_loc5_);
  585.       }
  586.       throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"unexpected end of cuePoint param string");
  587.    }
  588.    function addOrDisable(disable, cuePoint)
  589.    {
  590.       if(disable)
  591.       {
  592.          if(cuePoint.type == "actionscript")
  593.          {
  594.             throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"Cannot disable actionscript cue points");
  595.          }
  596.          this.setFLVCuePointEnabled(false,cuePoint);
  597.       }
  598.       else if(cuePoint.type == "actionscript")
  599.       {
  600.          this.addASCuePoint(cuePoint);
  601.       }
  602.    }
  603.    function unescape(origStr)
  604.    {
  605.       var _loc3_ = origStr;
  606.       var _loc1_ = 0;
  607.       while(_loc1_ < mx.video.CuePointManager.cuePointsReplace.length)
  608.       {
  609.          _loc1_;
  610.          var _loc2_ = _loc3_.split(mx.video.CuePointManager.cuePointsReplace[_loc1_++]);
  611.          if(_loc2_.length > 1)
  612.          {
  613.             _loc3_ = _loc2_.join(mx.video.CuePointManager.cuePointsReplace[_loc1_]);
  614.          }
  615.          _loc1_ = _loc1_ + 1;
  616.       }
  617.       return _loc3_;
  618.    }
  619.    function getCuePointIndex(cuePointArray, closeIsOK, time, name, start, len)
  620.    {
  621.       if(cuePointArray == null || cuePointArray == undefined || cuePointArray.length < 1)
  622.       {
  623.          return -1;
  624.       }
  625.       var _loc13_ = isNaN(time) || time < 0;
  626.       var _loc16_ = name == undefined || name == null;
  627.       if(_loc13_ && _loc16_)
  628.       {
  629.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"time must be number and/or name must not be undefined or null");
  630.       }
  631.       if(start == undefined || start == null)
  632.       {
  633.          start = 0;
  634.       }
  635.       if(len == undefined || len == null)
  636.       {
  637.          len = cuePointArray.length;
  638.       }
  639.       if(!_loc16_ && (closeIsOK || _loc13_))
  640.       {
  641.          var _loc8_ = undefined;
  642.          var _loc2_ = undefined;
  643.          if(_loc13_)
  644.          {
  645.             _loc8_ = start;
  646.          }
  647.          else
  648.          {
  649.             _loc8_ = this.getCuePointIndex(cuePointArray,closeIsOK,time);
  650.          }
  651.          _loc2_ = _loc8_;
  652.          while(_loc2_ >= start)
  653.          {
  654.             if(cuePointArray[_loc2_].name == name)
  655.             {
  656.                break;
  657.             }
  658.             _loc2_ = _loc2_ - 1;
  659.          }
  660.          if(_loc2_ >= start)
  661.          {
  662.             return _loc2_;
  663.          }
  664.          _loc2_ = _loc8_ + 1;
  665.          while(_loc2_ < len)
  666.          {
  667.             if(cuePointArray[_loc2_].name == name)
  668.             {
  669.                break;
  670.             }
  671.             _loc2_ = _loc2_ + 1;
  672.          }
  673.          if(_loc2_ < len)
  674.          {
  675.             return _loc2_;
  676.          }
  677.          return -1;
  678.       }
  679.       var _loc6_ = undefined;
  680.       if(len <= this._linearSearchTolerance)
  681.       {
  682.          var _loc11_ = start + len;
  683.          var _loc3_ = start;
  684.          while(_loc3_ < _loc11_)
  685.          {
  686.             _loc6_ = mx.video.CuePointManager.cuePointCompare(time,name,cuePointArray[_loc3_]);
  687.             if(_loc6_ == 0)
  688.             {
  689.                return _loc3_;
  690.             }
  691.             if(_loc6_ < 0)
  692.             {
  693.                break;
  694.             }
  695.             _loc3_ = _loc3_ + 1;
  696.          }
  697.          if(closeIsOK)
  698.          {
  699.             if(_loc3_ > 0)
  700.             {
  701.                return _loc3_ - 1;
  702.             }
  703.             return 0;
  704.          }
  705.          return -1;
  706.       }
  707.       var _loc12_ = Math.floor(len / 2);
  708.       var _loc15_ = start + _loc12_;
  709.       _loc6_ = mx.video.CuePointManager.cuePointCompare(time,name,cuePointArray[_loc15_]);
  710.       if(_loc6_ < 0)
  711.       {
  712.          return this.getCuePointIndex(cuePointArray,closeIsOK,time,name,start,_loc12_);
  713.       }
  714.       if(_loc6_ > 0)
  715.       {
  716.          return this.getCuePointIndex(cuePointArray,closeIsOK,time,name,_loc15_ + 1,_loc12_ - 1 + len % 2);
  717.       }
  718.       return _loc15_;
  719.    }
  720.    function getNextCuePointIndexWithName(name, array, index)
  721.    {
  722.       if(name == undefined || name == null)
  723.       {
  724.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"name cannot be undefined or null");
  725.       }
  726.       if(array == null || array == undefined)
  727.       {
  728.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"cuePoint.array undefined");
  729.       }
  730.       if(isNaN(index) || index < -1 || index >= array.length)
  731.       {
  732.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"cuePoint.index must be number between -1 and cuePoint.array.length");
  733.       }
  734.       var _loc1_ = undefined;
  735.       _loc1_ = index + 1;
  736.       while(_loc1_ < array.length)
  737.       {
  738.          if(array[_loc1_].name == name)
  739.          {
  740.             break;
  741.          }
  742.          _loc1_ = _loc1_ + 1;
  743.       }
  744.       if(_loc1_ < array.length)
  745.       {
  746.          return _loc1_;
  747.       }
  748.       return -1;
  749.    }
  750.    static function cuePointCompare(time, name, cuePoint)
  751.    {
  752.       var _loc2_ = Math.round(time * 1000);
  753.       var _loc3_ = Math.round(cuePoint.time * 1000);
  754.       if(_loc2_ < _loc3_)
  755.       {
  756.          return -1;
  757.       }
  758.       if(_loc2_ > _loc3_)
  759.       {
  760.          return 1;
  761.       }
  762.       if(name != null || name != undefined)
  763.       {
  764.          if(name == cuePoint.name)
  765.          {
  766.             return 0;
  767.          }
  768.          if(name < cuePoint.name)
  769.          {
  770.             return -1;
  771.          }
  772.          return 1;
  773.       }
  774.       return 0;
  775.    }
  776.    function getCuePoint(cuePointArray, closeIsOK, timeNameOrCuePoint)
  777.    {
  778.       var _loc3_ = undefined;
  779.       switch(typeof timeNameOrCuePoint)
  780.       {
  781.          case "string":
  782.             _loc3_ = {name:timeNameOrCuePoint};
  783.             break;
  784.          case "number":
  785.             _loc3_ = {time:timeNameOrCuePoint};
  786.             break;
  787.          case "object":
  788.             _loc3_ = timeNameOrCuePoint;
  789.       }
  790.       var _loc2_ = this.getCuePointIndex(cuePointArray,closeIsOK,_loc3_.time,_loc3_.name);
  791.       if(_loc2_ < 0)
  792.       {
  793.          return null;
  794.       }
  795.       _loc3_ = mx.video.CuePointManager.deepCopyObject(cuePointArray[_loc2_]);
  796.       _loc3_.array = cuePointArray;
  797.       _loc3_.index = _loc2_;
  798.       return _loc3_;
  799.    }
  800.    function getNextCuePointWithName(cuePoint)
  801.    {
  802.       if(cuePoint == null || cuePoint == undefined)
  803.       {
  804.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"cuePoint parameter undefined");
  805.       }
  806.       if(isNaN(cuePoint.time) || cuePoint.time < 0)
  807.       {
  808.          throw new mx.video.VideoError(mx.video.VideoError.ILLEGAL_CUE_POINT,"time must be number");
  809.       }
  810.       var _loc3_ = this.getNextCuePointIndexWithName(cuePoint.name,cuePoint.array,cuePoint.index);
  811.       if(_loc3_ < 0)
  812.       {
  813.          return null;
  814.       }
  815.       var _loc4_ = mx.video.CuePointManager.deepCopyObject(cuePoint.array[_loc3_]);
  816.       _loc4_.array = cuePoint.array;
  817.       _loc4_.index = _loc3_;
  818.       return _loc4_;
  819.    }
  820.    static function deepCopyObject(obj, recurseLevel)
  821.    {
  822.       if(obj == undefined || obj == null || typeof obj != "object")
  823.       {
  824.          return obj;
  825.       }
  826.       if(recurseLevel == undefined)
  827.       {
  828.          recurseLevel = 0;
  829.       }
  830.       var _loc2_ = new Object();
  831.       for(var _loc4_ in obj)
  832.       {
  833.          if(!(recurseLevel == 0 && (_loc4_ == "array" || _loc4_ == "index")))
  834.          {
  835.             if(typeof obj[_loc4_] == "object")
  836.             {
  837.                _loc2_[_loc4_] = mx.video.CuePointManager.deepCopyObject(obj[_loc4_],recurseLevel + 1);
  838.             }
  839.             else
  840.             {
  841.                _loc2_[_loc4_] = obj[_loc4_];
  842.             }
  843.          }
  844.       }
  845.       return _loc2_;
  846.    }
  847. }
  848.